package main

import (
	"week13/log"
)

type MyError struct {
	Code int
	Message string
}
func (e *MyError) Error() string  {
	return e.Message
}
func main()  {
	log.Info("what",1,2,3,[]string{"a","b","c"})
	//hook := lumberjack.Logger{
	//	Filename:   "./test.log",  //日志文件路径
	//	MaxSize:    128, //最大字节
	//	MaxAge:     30,
	//	MaxBackups: 7,
	//	Compress:   true,
	//}
	//w := zapcore.AddSync(&hook)
	//encoderConfig := zapcore.EncoderConfig{
	//	MessageKey: "msg",
	//	LevelKey:       "level",
	//	TimeKey:        "time",
	//	NameKey:        "name",
	//	CallerKey:      "line",
	//	StacktraceKey:  "stacktrace",
	//	LineEnding:     zapcore.DefaultLineEnding,
	//	EncodeLevel:    zapcore.LowercaseLevelEncoder,
	//	EncodeTime:     zapcore.ISO8601TimeEncoder,
	//	EncodeDuration: zapcore.SecondsDurationEncoder,
	//	EncodeCaller:   zapcore.FullCallerEncoder,
	//	EncodeName:     zapcore.FullNameEncoder,
	//}
	//
	//core := zapcore.NewCore(
	//	zapcore.NewConsoleEncoder(encoderConfig),
	//	w,
	//	zap.DebugLevel,
	//)
	//
	//logger := zap.New(core,zap.AddCaller())
	//defer logger.Sync()
	//logger.Info("HELOO,XXXX")
	//logger.Sugar().Infof("say %s","sam")
	//err := CreateErr()
	//MyE := new(MyError)
	//fmt.Println( errors.As(err,&MyE) )
	//E := perrors.Wrap(err,"HELLO")
	//fmt.Println(MyE,E)
	//
	//MyE2 := new(MyError)
	//fmt.Println(errors.Is(E, MyE2))
	//fmt.Println(errors.As(perrors.Cause(E),&MyE2))
}
//func CreateErr() error {
//	log.Output(4,"HELLO")
//	err := &MyError{
//		Code:    1,
//		Message: "111",
//	}
//	return err
//}
